import axios from "axios";
import NProgress from "nprogress";
import 'nprogress/nprogress.css'
const request = axios.create({
    baseURL: '/api1',
    timeout: 10000,
})
request.interceptors.request.use(function (config) {
    NProgress.start();
    return config;
}, function (e) {
    NProgress.done();
    return Promise.reject(e);
})
request.interceptors.response.use(function (response) {
    NProgress.done();
    if (response.data.code !== 10000) {
        return Promise.reject({
            message: response.data.msg
        })
    }
    return response.data.msg;
}, function (e) {
    NProgress.done();
    return Promise.reject(e);
});
export default request;